package com.pengpeng.dubbo.provider.service.impl;

import com.pengpeng.dubbo.api.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.rpc.RpcContext;

/**
 * @author 彭鹏
 * @date 2021/10/27.
 */
@Slf4j
@DubboService
public class UserServiceImpl implements UserService {
    @Override
    public String hello(String name) {
        log.info("Hello " + name + ", request from consumer: " + RpcContext.getServerContext().getRemoteAddress());
        return "Hello " + name + ", response from provider: " + RpcContext.getServerContext().getLocalAddress();
    }
}
